# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=dolphin
pkgver=24.08.2
pkgrel=0
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/applications/system/dolphin"
pkgdesc="KDE File Manager"
license="GPL-2.0-only"
depends="
	udisks2
	kio-extras
	"
depends_dev="
	baloo-dev
	baloo-widgets-dev
	kbookmarks-dev
	kcmutils-dev
	kcompletion-dev
	kconfig-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	kfilemetadata-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	knewstuff-dev
	knotifications-dev
	kparts-dev
	ktextwidgets-dev
	kuserfeedback-dev
	kwindowsystem-dev
	musl-fts-dev
	phonon-dev
	plasma-activities-dev
	qt6-qtbase-dev
	solid-dev
	"
makedepends="$depends_dev
	extra-cmake-modules	
	ruby-test-unit
	samurai
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-zsh-completion"
_repo_url="https://invent.kde.org/system/dolphin.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/dolphin-$pkgver.tar.xz"

build() {
	LDFLAGS="$LDFLAGS -Wl,-z,stack-size=0x100000" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# kfileitemmodeltest, dolphinquerytest and dolphinmainwindowtest are broken
	xvfb-run -a ctest --test-dir build --output-on-failure -E "(kfileitemmodel|dolphinquery|dolphinmainwindow)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
c4755443373fc8fc1d5bc8eac1dccee436eca0617e6e62b9f36400f026821f7ffc5cb478406d508487f11064d8e18cecb853627383bf97670b78370cc1c543a3  dolphin-24.08.2.tar.xz
"
